//
//  ConditionResultView.swift
//  MakeMoney
//
//  Created by Fan ZhiQiang on 2024/12/26.
//

import SwiftUI

struct ConditionResultView: View {
    @Bindable var pathStore: PathStore
    @Binding var param: NumberParam
    @State private var lotterys: [Lottery] = []
    
    var body: some View {
        LotterysView(lotterys: lotterys)
            .toolbar {
                ToolbarItem(placement: .topBarTrailing) {
                    Button("统计") {
                        
                    }
                }
            }
            .navigationTitle("结果")
            .navigationDestination(for: YearStatisticPath.self) { _ in
                
            }
            .onAppear {
                lotterys = getLotterysWithCondition(startDate: param.startDate, endDate: param.endDate, front1: param.front1, front2: param.front2, front3: param.front3, front4: param.front4, front5: param.front5, hind1: param.hind1, hind2: param.hind2, ball: param.ball)
            }
    }
}

#Preview {
    ConditionResultView(pathStore: .init(), param: .constant(NumberParam()))
}

class ConditionResultPath: PathName { }
